<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html:html>
    <head>
        <title>Gestion EDT - Modules</title>

        <link rel="stylesheet" type="text/css" href="resources/css/design.css" />
        <link rel="stylesheet" type="text/css" href="resources/css/design_print.css" media="print" />
        <link rel="stylesheet" type="text/css" href="resources/css/modules.css" />

        <script type="text/javascript" src="resources/js/script.js"></script>
    </head>
    <body>
        <jsp:include page="_menu.jsp" />

        <bean:define id="nv" value="${ModulesForm.module.id == null || ModulesForm.module.id == 0}" />

        <h1 class="titrePage">
            <c:if test="${nv}">Ajout d'un module</c:if>
            <c:if test="${!nv}">Modification du module '${ModulesForm.module.libelle}'</c:if>
        </h1>

        <html:errors/>

        <html:form action="/EnregistrerModule" focus="module.libelle" styleId="formModule">

            <html:hidden property="module.id" />

            <div class="elemForm">
                <label for="libelle">Libellé</label>
                <html:text property="module.libelle" styleId="libelle" maxlength="50" />
            </div>
            <div class="elemForm">
                <label for="ue">UE</label>
                <html:text property="module.ue" styleId="ue" maxlength="50" />
            </div>
            <div class="elemForm">
                <label for="effectifMax">Effectif max.</label>
                <html:text property="module.effectifMax" styleId="effectifMax" />
            </div>
            <div class="elemForm">
                <label for="estTermine">Terminé</label>
                <html:checkbox property="module.estTermine" styleId="estTermine" />
            </div>

            <p class="boutons">
                <c:if test="${nv}"><html:submit value="Ajouter" /></c:if>
                <c:if test="${!nv}"><html:submit value="Modifier" /></c:if>
                <c:if test="${!nv}">
                    <html:link action="/GererModules?action=afficherNv" styleClass="bouton">
                        Nouveau
                    </html:link>
                </c:if>
                <html:cancel value="Retour liste" />
            </p>

            <html:hidden property="sousFormStr" />

        </html:form>

        <bean:define id="erreursForm" value="${not empty requestScope['org.apache.struts.action.ERROR']}" />

        <c:if test="${!nv && !erreursForm}">
            <div class="onglets">
                <ul>
                    ${(ModulesForm.sousForm == "PRESTATIONS") ? '<li class="selected">' : '<li>'}
                        <html:link
                            action="/GererModules?action=afficher&sousFormStr=PRESTATIONS"
                            paramId="idModule" paramName="ModulesForm" paramProperty="module.id">
                            Prestations
                        </html:link>
                    </li>
                    ${(ModulesForm.sousForm == "GROUPES") ? '<li class="selected">' : '<li>'}
                        <html:link
                            action="/GererModules?action=afficher&sousFormStr=GROUPES"
                            paramId="idModule" paramName="ModulesForm" paramProperty="module.id">
                            Inscriptions groupes
                        </html:link>
                    </li>
                    ${(ModulesForm.sousForm == "POOLS") ? '<li class="selected">' : '<li>'}
                        <html:link
                            action="/GererModules?action=afficher&sousFormStr=POOLS"
                            paramId="idModule" paramName="ModulesForm" paramProperty="module.id">
                            Pools
                        </html:link>
                    </li>
                </ul>
            </div>

            <c:if test="${ModulesForm.sousForm == 'PRESTATIONS'}">
                <jsp:include page="_prestationsModule.jsp" />
            </c:if>
            <c:if test="${ModulesForm.sousForm == 'GROUPES'}">
                <jsp:include page="_inscriptionsModule.jsp" />
            </c:if>
            <c:if test="${ModulesForm.sousForm == 'POOLS'}">
                <jsp:include page="_poolsModule.jsp" />
            </c:if>
        </c:if>

    </body>
</html:html>